// store/menu.js
import { defineStore } from "pinia";

export const dictionary = defineStore("dictionary", {
  state: () => ({
    ZD: {
      positionType: null,
      positionWelfare: null,
    },
  }),
  actions: {
    getList(data){
      data.$http.post('/sys-dict/getByTypeList',[1]).then(res=>{
        if(res.data){
          localStorage.setItem('positionType',JSON.stringify(res.data) );
          this.ZD.positionType = res.data
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[2]).then(res=>{
        if(res.data){
          localStorage.setItem('positionWelfare', JSON.stringify(res.data));
          this.ZD.positionWelfare = res.data
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[3]).then(res=>{
        if(res.data){
          localStorage.setItem('profession', JSON.stringify(res.data));
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[4]).then(res=>{
        if(res.data){
          localStorage.setItem('staffSize', JSON.stringify(res.data));
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[9]).then(res=>{
        if(res.data){
          localStorage.setItem('positionWorkYear', JSON.stringify(res.data));
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[10]).then(res=>{
        if(res.data){
          localStorage.setItem('positionAge', JSON.stringify(res.data));
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[11]).then(res=>{
        if(res.data){
          localStorage.setItem('positionSalary', JSON.stringify(res.data));
        }
      })
      data.$http.post('/sys-dict/getByTypeList',[12]).then(res=>{
        if(res.data){
          localStorage.setItem('positionDayMoney', JSON.stringify(res.data));
        }
      })
    },
    changePositionType(data){
      this.ZD.positionType = data
    },
    changePositionWelfare(data){
      this.ZD.positionWelfare = data
    },
  },
});
export default dictionary